package com.zzyl.nursing.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zzyl.common.annotation.Log;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.enums.BusinessType;
import com.zzyl.nursing.domain.HealthAssessmentDetail;
import com.zzyl.nursing.service.IHealthAssessmentDetailService;
import com.zzyl.common.utils.poi.ExcelUtil;
import com.zzyl.common.core.page.TableDataInfo;

/**
 * 健康评估详情Controller
 * 
 * @author ruoyi
 * @date 2025-08-24
 */
@RestController
@RequestMapping("/nursing/healthAssessmentDetail")
public class HealthAssessmentDetailController extends BaseController
{
    @Autowired
    private IHealthAssessmentDetailService healthAssessmentDetailService;

    /**
     * 查询健康评估详情列表
     */
    @PreAuthorize("@ss.hasPermi('nursing:healthAssessmentDetail:list')")
    @GetMapping("/list")
    public TableDataInfo list(HealthAssessmentDetail healthAssessmentDetail)
    {
        startPage();
        List<HealthAssessmentDetail> list = healthAssessmentDetailService.selectHealthAssessmentDetailList(healthAssessmentDetail);
        return getDataTable(list);
    }

    /**
     * 导出健康评估详情列表
     */
    @PreAuthorize("@ss.hasPermi('nursing:healthAssessmentDetail:export')")
    @Log(title = "健康评估详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HealthAssessmentDetail healthAssessmentDetail)
    {
        List<HealthAssessmentDetail> list = healthAssessmentDetailService.selectHealthAssessmentDetailList(healthAssessmentDetail);
        ExcelUtil<HealthAssessmentDetail> util = new ExcelUtil<HealthAssessmentDetail>(HealthAssessmentDetail.class);
        util.exportExcel(response, list, "健康评估详情数据");
    }

    /**
     * 获取健康评估详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('nursing:healthAssessmentDetail:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(healthAssessmentDetailService.selectHealthAssessmentDetailById(id));
    }

    /**
     * 新增健康评估详情
     */
    @PreAuthorize("@ss.hasPermi('nursing:healthAssessmentDetail:add')")
    @Log(title = "健康评估详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HealthAssessmentDetail healthAssessmentDetail)
    {
        return toAjax(healthAssessmentDetailService.insertHealthAssessmentDetail(healthAssessmentDetail));
    }

    /**
     * 修改健康评估详情
     */
    @PreAuthorize("@ss.hasPermi('nursing:healthAssessmentDetail:edit')")
    @Log(title = "健康评估详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HealthAssessmentDetail healthAssessmentDetail)
    {
        return toAjax(healthAssessmentDetailService.updateHealthAssessmentDetail(healthAssessmentDetail));
    }

    /**
     * 删除健康评估详情
     */
    @PreAuthorize("@ss.hasPermi('nursing:healthAssessmentDetail:remove')")
    @Log(title = "健康评估详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(healthAssessmentDetailService.deleteHealthAssessmentDetailByIds(ids));
    }
}
